home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 July / Chip_2000-07_cd.bin / sharewar / vbshpdfc / Install.exe / VB Shaped Form Creator.CAB / About2.frm < prev    next >
Text File  |  2000-04-13  |  5KB  |  86 lines

  1. Version 5.00
  2. Begin VB.Form ShapedForm
  3.    BorderStyle = 0        'None
  4.    ControlBox = 0          'False
  5.    ClientHeight = 3000
  6.    ClientWidth = 3000
  7.    ClientLeft = 4500
  8.    ClientTop = 3000
  9.    MaxButton = 0           'False
  10.    ShowInTaskbar = 1       'True
  11.    Caption = "ShapedForm"
  12.    End
  13. Attribute VB_Name = "ShapedForm"
  14. Attribute VB_Creatable = False
  15. Attribute VB_Exposed = False
  16. Option Explicit
  17. Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
  18. Private Declare Function CreateRectRgn Lib "gdi32" (ByVal x1 As Long, ByVal y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  19. Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal x1 As Long, ByVal y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
  20. Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal x1 As Long, ByVal y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  21. Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
  22. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  23. Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
  24. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  25. Private Declare Function ReleaseCapture Lib "user32" () As Long
  26. Private Type POINTAPI
  27.    X As Long
  28.    Y As Long
  29. End Type
  30. Private Const RGN_COPY = 5
  31. Private Const CreatedBy = "VBSFC 6"
  32. Private Const RegisteredTo = "Not Registered"
  33. Private ResultRegion As Long
  34. Private Function CreateFormRegion(ScaleX As Single, ScaleY As Single, OffsetX As Integer, OffsetY As Integer) As Long
  35.     Dim HolderRegion As Long, ObjectRegion As Long, nRet As Long, Counter As Integer
  36.     Dim PolyPoints() As POINTAPI
  37.     ResultRegion = CreateRectRgn(0, 0, 0, 0)
  38.     HolderRegion = CreateRectRgn(0, 0, 0, 0)
  39.  
  40. 'This procedure was generated by VB Shaped Form Creator.  This copy has
  41. 'NOT been registered for commercial use.  It may only be used for non-
  42. 'profit making programs.  If you intend to sell your program, I think
  43. 'it's only fair you pay for mine.  Commercial registration costs $30,
  44. 'and can be performed online.  See "Registration" item on the help menu
  45. 'for details.
  46.  
  47. 'Latest versions of VB Shaped Form Creator can be found at my website at
  48. 'http://www.comports.com/AlexV/VBSFC.html or you can visit my main site
  49. 'with many other free programs and utilities at http://www.comports.com/AlexV
  50.  
  51. 'Lines starting with '! are required for reading the form shape using the
  52. 'Import Form command in VB Shaped Form Creator, but are not necessary for
  53. 'Visual Basic to display the form correctly.
  54.  
  55. '!Shaped Form Region Definition
  56. '!3,0,0,200,200,0,0,1
  57.     ObjectRegion = CreateEllipticRgn(0 * ScaleX *15 / Screen.TwipsPerPixelX + OffsetX, 0 * ScaleY *15 / Screen.TwipsPerPixelY + OffsetY, 200 * ScaleX *15 / Screen.TwipsPerPixelX + OffsetX, 200 * ScaleY *15 / Screen.TwipsPerPixelY + OffsetY)
  58.     nRet = CombineRgn(ResultRegion, ObjectRegion, ObjectRegion, RGN_COPY)
  59.     DeleteObject ObjectRegion
  60. '!3,0,0,200,200,0,0,1
  61.     ObjectRegion = CreateEllipticRgn(0 * ScaleX *15 / Screen.TwipsPerPixelX + OffsetX, 0 * ScaleY *15 / Screen.TwipsPerPixelY + OffsetY, 200 * ScaleX *15 / Screen.TwipsPerPixelX + OffsetX, 200 * ScaleY *15 / Screen.TwipsPerPixelY + OffsetY)
  62.     nRet = CombineRgn(HolderRegion, ResultRegion, ResultRegion, RGN_COPY)
  63.     nRet = CombineRgn(ResultRegion, HolderRegion, ObjectRegion, 2)
  64.     DeleteObject ObjectRegion
  65.     DeleteObject HolderRegion
  66.     CreateFormRegion = ResultRegion
  67. End Function
  68.  
  69. Private Sub Form_Load()
  70.     Dim nRet As Long
  71.     nRet = SetWindowRgn(Me.hWnd, CreateFormRegion(1, 1, 0, 0), True)
  72.     'If the above two lines are modified or moved a second copy of
  73.     'them may be added again if the form is later Modified by VBSFC.
  74. End Sub
  75. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  76. 'Next two lines enable window drag from anywhere on form.  Remove them
  77. 'to allow window drag from title bar only.
  78.     ReleaseCapture
  79.     SendMessage Me.hWnd, &HA1, 2, 0&
  80. End Sub
  81. Private Sub Form_Unload(Cancel As Integer)
  82.     DeleteObject ResultRegion
  83.     'If the above line is modified or moved a second copy of it
  84.     'may be added again if the form is later Modified by VBSFC.
  85. End Sub
  86.